package com.hx.voice.recognition.auth.server.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.hx.voice.recognition.auth.server.entity.AuthClient;
import com.hx.voice.recognition.auth.server.util.user.JwtAuthenticationRequest;

import java.util.List;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author jack
 * @since 2019-06-13
 */
public interface IAuthClientService extends IService<AuthClient> {

    /**
     * @description 申请
     * @method  apply
     * @param  [client, secret]
     * @return java.lang.String
     * @date: 2019/6/14 10:42
     * @author:zhoujinbing
     */
    String apply(String client, String secret) throws Exception;

    /**
     * @description 根据应用ID以及盐查询可被允许调用的
     * @method  getAllowedClient
     * @param  [serviceId, secret]
     * @return java.util.List<java.lang.String>
     * @date: 2019/6/14 15:13
     * @author:zhoujinbing
     */
    List<String> getAllowedClient(String serviceId, String secret);

    /**
     * @description 校验应用是否存在
     * @method  validate
     * @param  [clientId, secret]
     * @return void
     * @date: 2019/6/14 15:30
     * @author:zhoujinbing
     */
    void validate(String clientId, String secret);

    /**
     * @description 登录生成token
     * @method  login
     * @param  [authenticationRequest]
     * @return java.lang.String
     * @date: 2019/6/18 14:38
     * @author:zhoujinbing
     */
    String login(JwtAuthenticationRequest authenticationRequest) throws Exception;

    /**
     * @description 刷新token
     * @method  refreshToken
     * @param  [token]
     * @return java.lang.String
     * @date: 2019/6/18 14:47
     * @author:zhoujinbing
     */
    String refreshToken(String token) throws Exception;

    /**
     * @description 校验token
     * @method  verify
     * @param  [token]
     * @return void
     * @date: 2019/6/18 14:52
     * @author:zhoujinbing
     */
    void verify(String token) throws Exception;

    /**
     * @description 根据clientId查询
     * @method  getAllowedClient
     * @param  [clientId]
     * @return java.lang.String[]
     * @date: 2019/6/20 9:41
     * @author:zhoujinbing
     */
    List<String>  getAllowedClient(String clientId);
}
